1. Technical Field
This invention relates to metadata and synchronizing changes to metadata. More specifically, a modified synchronization operation is employed to support an asynchronous write operation by allowing a client to continue to make changes to a data file while the synchronization operation is in the process of updating metadata with a server.
2. Description of the Prior Art
FIG. 1 is a block diagram (10) of a prior art distributed system with shared persistent storage. The distributed system includes a storage area network (22) with multiple server nodes (30) and (40), an administrator node (50), and multiple client nodes (52) and (54). The storage area network (22) has file data space (24) and metadata space (26). The metadata space is reserved for the servers (30) and (40). Each of the clients (52) and (54) may access an object or multiple objects stored on the file data space (24) of the storage area network (22), but may not access the metadata space (26). In opening the contents of an existing file object on the storage media in the storage area network (22), a client contacts the server to obtain metadata and locks. The server performs a look-up of metadata information for the requested file within the metadata space (26) of the storage area network (22). One of the servers (30) or (40) communicates granted lock information and file metadata to the requesting client, including the location of all data blocks making up the file. Once the client holds a distributed lock and knows the data block location(s), the client can access the data for the file directly from a shared storage device attached to the storage area network.
With respect to the system shown in FIG. 1, metadata provides information pertaining to location of data requested from a client machine in a distributed file system or a client/server node in a non-distributed file system. Metadata contains information in the form of blocks used, file size, modification time, etc. In a distributed file system, the metadata is maintained by the server. Upon access of a file by a client changes to the file may occur. Metadata reflecting the changes need to be communicated to the server. There are two general categories of write modes. A first category is known as a synchronous write mode wherein all writers or metadata modifiers of a corresponding file object are blocked from proceeding with writing any additional changes to a data file until a prior metadata transaction update to the server node is completed. The second category is known as an asynchronous write mode which supports writers or metadata modifiers changing a corresponding file object and defers data and metadata transaction updates to the server. FIG. 2 is a flow chart (100) illustrating a prior art process of an asynchronous write operation. Upon receiving a write request, a client conducts a test to determine if a write to the data in the file can proceed (102). A negative response will require the client to wait to make changes to the file for a period of time before returning to step (102) to repeat the inquiry. In one embodiment, an application thread sleeps until a thread that synchronizes the data and metadata wakes up the application thread. Once a positive response to the test at step (102) is received, the application on the client updating the file writes data into the clients data cache (104). Following step (104), the application updates the metadata in the clients cache (106), and the application returns to processing (108). In an asynchronous write mode, there is greater concern for immediate performance than in writing data to disk and synchronizing the client's cache with the cache of the server. A file system operating in an asynchronous manner may employ a synchronization thread to execute a delayed synchronization operation when the state of the client metadata and the server metadata need to be consistent. Usually this synchronization thread will run periodically to synchronize the client's cache with persistent storage. Accordingly, the prior art asynchronous write mode eventually employs a synchronization thread when the clients data cache needs to be written to persistent storage and consistency of the client metadata with the server metadata is required.
FIG. 3 is a flow chart (120) illustrating a prior art synchronization thread, also known as a synchronization operation, for synchronizing file system cache. This synchronization usually employs the following two sequential steps: writing data cache to disk, and updating the metadata changes. In a distributed file system, the metadata changes need to be updated to the server. Following changes to a data file by an application, synchronization of the client data file is initiated (122). Once the synchronization operation is initiated, the current application or other applications executing on the client are blocked from making further changes to the data file (124). Thereafter, the clients data cache is written to persistent storage of local storage media (126), followed by sending a transaction update of the client's metadata changes to the server and the client enters a wait state while it is waiting to receive a response (128). Once the client sends the metadata transaction update to the server, the clients cache is marked to reflect the outgoing communication and the client waits to receive a response from the server before proceeding with allowing an application to write to a file. Following receipt of the metadata update (130), the server sends the metadata update transaction to persistent storage in a storage area network (132) followed by a response to the client that initiated the metadata update indicating recordation of the metadata change in the storage area network (134). Similarly, upon receipt of a communication from the server (136), the client processes the response (138) so that applications may proceed with writing to that data file (140). The communication received by the client at step (136) does not indicate the recordation of metadata changes by the server. Rather, the communication received at step (136) will indicate whether the metadata update was properly recorded in the shared storage media. If the metadata update was not recorded this indicates that an error occurred and the server cannot apply the client's changes to the metadata. Accordingly, the prior art example shown in FIG. 3, shows a synchronization operation where writers or metadata modifiers of the corresponding file object are blocked from proceeding with writing any additional changes to a data file until the metadata update in progress is complete through a transaction to the server.
As illustrated above, there are shortcomings associated with the prior art. For example, all modifiable operations to the data file are blocked for the entire duration of the synchronization process of that file. This block duration is significant in a distributed file system where network transactions are involved. If more than one synchronization thread is running in parallel, this could cause miscommunication for applications streaming transaction updates to the server. Therefore, there is a need for modifying the prior art synchronization process to support a metadata update transaction that does not block writers or applications that modify metadata for the entire period of a metadata update transaction.